const path = require("path");
const resolve = dir => path.join(__dirname, dir);
const env = process.env.NODE_ENV;
const os=require('os');
module.exports = {
    // 如果是hash模式
    publicPath: env !== 'development' ? './' : '/',

    // 如果是history模式
    // publicPath: env !== "development" ? "/" : "/",

    // 静态资源目录 (js, css, img, fonts)
    assetsDir: 'assets',

    // 关键点在这  原来的 Compiler 换成了 runtimeCompiler
    runtimeCompiler: true,

    // 下面两种配置方式选一即可
    // 一、配置式
    configureWebpack: (config) => {
        config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true;
    },
    chainWebpack: config => {
        // 资源文件别名
        config.resolve.alias
            .set("@", resolve("src"))
            .set("@assets", resolve("src/assets"))
            .set("@scss", resolve("src/assets/scss"))
            .set("@components", resolve("src/components"))
            .set("@plugins", resolve("src/plugins"))
            .set("@views", resolve("src/views"))
            .set("@router", resolve("src/router"))
            .set("@store", resolve("src/store"))
            .set("@layouts", resolve("src/layouts"))
            .set("@static", resolve("src/static"));
    },
    devServer: {
        proxy: 'http://127.0.0.1:8000'
    },
    lintOnSave: false,
};
